package com.lovo;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 菜单界面
 */
public class MenuPanel extends JPanel implements ActionListener {
    private JButton backBtn;
    private Test02 frame;
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);

    }

    public MenuPanel(Test02 frame){
        this.frame = frame;
        this.setLayout(null);
        this.setOpaque(false);
        JLabel titleLabel = new JLabel("菜单");
        titleLabel.setBounds(200,50,100,50);
        this.add(titleLabel);

        backBtn = new JButton("返回");
        backBtn.setBounds(200,150,100,50);
        this.add(backBtn);
        backBtn.addActionListener(this);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if(backBtn == e.getSource()){
            frame.switchPanel("login");
        }
    }
}
